package com.four.treatment.service.impl;

import com.four.common.vo.DoctorVo;
import com.four.common.vo.UserTo;
import com.four.common.vo.UserVo;
import com.four.treatment.dao.ReceptionDeskDao;
import com.four.treatment.entity.ReceptionDesk;
import com.four.treatment.fegin.HospitalFeginService;
import com.four.treatment.service.ReceptionDeskService;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @Author:wsy
 * @Date: 2022/01/23/14:05
 * @Description
 */
@Service
public class ReceptionDeskServiceImpl implements ReceptionDeskService {

    @Autowired
    private ReceptionDeskDao receptionDeskDao;

    @Autowired
    private HospitalFeginService hospitalFeginService;

    /**
     * 患者发送消息
     * 添加到接诊台
     * @param receptionDesk
     * @param message
     * @param userPhone
     */
    @Override
    public void toReception(ReceptionDesk receptionDesk, String message, String userPhone,Integer docId) {
        //根据用户手机号查询用户信息
        UserVo userVo=hospitalFeginService.findByUserPhone(userPhone);
        System.out.println(userVo);
        //根据医生编号查询医生信息
        DoctorVo doctorVo=hospitalFeginService.findByDocId(docId);
        receptionDesk.setAge(userVo.getUserAge());
        receptionDesk.setDeskDate(new Date());
        receptionDesk.setDeskName(userVo.getUserName());
        receptionDesk.setDeskPrice(doctorVo.getDocPrice());
        receptionDesk.setDocId(doctorVo.getDocId());
        receptionDesk.setMessage(message);
        receptionDeskDao.toReception(receptionDesk);
    }
}
